package com.jingtai.platform.controller.supply;

import com.jingtai.core.entity.supply.UndertakesDetail;
import com.jingtai.platform.service.supply.UndertakesDetailService;
import com.jingtai.platform.util.ResultUtil;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.jingtai.validate.swagger.CApiParam;

/**
 * 一件代发详情
 *
 * @author sunlaiqian
 * @date 2020-12-02 18:31:31
 */
@Validated
@RestController
@RequestMapping("/platform/undertakesdetail")
@Api(tags = "一件代发详情")
public class UndertakesDetailController{

    @Autowired
    private UndertakesDetailService undertakesDetailService;


    @ApiOperation("一件代发详情列表查询")
    @GetMapping("/list")
    public ResultUtil aopUndertakesDetailList(@CApiParam(name = "page",value = "页数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("page") Integer page,
                              @CApiParam(name = "limit",value = "每页个数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("limit") Integer limit,
                              @CApiParam(name = "conditions",value = "查询条件",required = false) @RequestParam("conditions") String conditions){
        return undertakesDetailService.UndertakesDetaillist(page, limit, conditions);
    }


    @ApiOperation("根据ID查询undertakesDetail实体")
    @GetMapping("/getUndertakesDetailById")
    public ResultUtil GetUndertakesDetailById(@CApiParam(name = "id",value = "undertakesDetail实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return undertakesDetailService.getUndertakesDetailById(id);
    }


    @ApiOperation("新增undertakesDetail实体")
    @PostMapping("/add")
    @ApiOperationSupport(ignoreParameters = {"undertakesDetail.id","undertakesDetail.createTime","undertakesDetail.updateTime","undertakesDetail.deleteFlag"})
    public ResultUtil aopAddUndertakesDetail(@RequestBody @Validated UndertakesDetail undertakesDetail){
        return undertakesDetailService.addUndertakesDetail(undertakesDetail);
    }

    @ApiOperation("编辑undertakesDetail实体")
    @PostMapping("/edit")
    @ApiOperationSupport(ignoreParameters = {"undertakesDetail.createTime","undertakesDetail.updateTime","undertakesDetail.deleteFlag"})
    public ResultUtil aopEditUndertakesDetail(@RequestBody @Validated UndertakesDetail undertakesDetail){
        return undertakesDetailService.editUndertakesDetail(undertakesDetail);
    }

    @ApiOperation("根据ID删除undertakesDetail实体")
    @GetMapping("/delUndertakesDetailById")
    public ResultUtil aopDelUndertakesDetailById(@CApiParam(name = "id",value = "undertakesDetail实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return undertakesDetailService.delUndertakesDetailById(id);
    }

}






